﻿@model SportsStore.WebUI.Models.AdminIndexViewModel
@{
    ViewBag.Title = "Admin: All Products";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
<h2>
    All Products</h2>

<h1>
    All Products</h1>
    @using (Html.BeginForm("Index", "Admin",FormMethod.Get))
    {
        @Html.DropDownListFor(m => m.CategoryId, Model.GetCategoryList())
        <input type="submit" value="Filter"/>
    }
<p>
    @Html.ActionLink("View/Edit All Category","CategoryIndex","Admin");
</p>
<table class="Grid">
    <tr>
        <th>
            ID
        </th>
        <th>
            Name
        </th>
        <th class="NumericCol">
            Price
        </th>
        <th>
            Actions
        </th>
        <td>
            
        </td>
    </tr>
    @foreach (var item in Model.Products)
    {
        <tr>
            <td>@item.Id
            </td>
            <td>@Html.ActionLink(item.Name, "Edit", new { ProductID = item.Id })
            </td>
            <td class="NumericCol">@item.Price.ToString("c")
            </td>
            <td>
                @using (Html.BeginForm("Delete", "Admin"))
                {
                    @Html.Hidden("ProductID", item.Id)
                    <input type="submit" value="Delete" />
                }
            </td>
            <td>
                @Html.ActionLink("资料管理", "Index", "Document", new { productId = item.Id }, null)
            </td>
        </tr>
    }
</table>
<p>@Html.ActionLink("Add a new product", "Create")</p>
